<?php

use yii\db\Migration;

class m240417_014729_diandi_tea_set_meal_list extends Migration
{
    public function up()
    {
        /* 取消外键约束 */
        $this->execute('SET foreign_key_checks = 0');
        
        /* 创建表 */
        $this->createTable('{{%diandi_tea_set_meal_list}}', [
            'id' => "int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '套餐消费记录id'",
            'bloc_id' => "int(11) NOT NULL COMMENT '人脸库组id'",
            'store_id' => "int(11) NOT NULL",
            'create_time' => "datetime NULL",
            'update_time' => "datetime NULL",
            'title' => "varchar(100) NULL COMMENT '套餐名'",
            'duration' => "smallint(6) NULL COMMENT '套餐时长'",
            'price' => "decimal(10,2) NULL COMMENT '套餐价格'",
            'renew_price' => "decimal(10,2) NULL COMMENT '每半小时续费单价'",
            'order_id' => "int(11) NULL COMMENT '订单id'",
            'set_meal_id' => "int(11) NULL COMMENT '套餐id'",
            'member_id' => "int(11) NULL COMMENT '会员id'",
            'PRIMARY KEY (`id`)'
        ], "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='套餐消费记录表'");
        
        /* 索引设置 */
        
        
        /* 表数据 */
        
        /* 设置外键约束 */
        $this->execute('SET foreign_key_checks = 1;');
    }

    public function down()
    {
        $this->execute('SET foreign_key_checks = 0');
        /* 删除表 */
        $this->dropTable('{{%diandi_tea_set_meal_list}}');
        $this->execute('SET foreign_key_checks = 1;');
    }
}

